package com.zgjkhis.modules.system.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @Author yzq
 * @Description 处方详情单
 * @Date 2021/6/23 9:38
 * @Param
 * @return
 **/
@Data
@TableName("his_prescription_info_drug")
public class InfoDrug implements Serializable {

    @TableId
    private Long id;

    @ApiModelProperty(value = "处方号")
    private String infoNo;
    @ApiModelProperty(value = "订单号")
    private String orderNo;
    @ApiModelProperty(value = "药品id")
    private Long drugId;
    @ApiModelProperty(value = "药品名称")
    private String drugName;
    @ApiModelProperty(value = "药品规格")
    private String specification;
    @ApiModelProperty(value = "一次剂量")
    @NotNull(message = "单词剂量不能为空")
    private BigDecimal dose;
    @ApiModelProperty(value = "剂量单位")
    private String doseUnit;
    @ApiModelProperty(value = "药品用法")
    private String usageName;
    @ApiModelProperty(value = "煎煮法名称")
    private String decoctionName;
    @ApiModelProperty(value = "药品数量")
    private Integer quantity;
    @ApiModelProperty(value = "剂量单位药品数量")
    private Integer minQuantity;
    @ApiModelProperty(value = "单价")
    private BigDecimal price;
    @ApiModelProperty(value = "包装单位")
    private String packUnit;
    @ApiModelProperty(value = "总剂量单位(当药品分类为3，4，5时，有值，存在)")
    private String totalDoseUnit;
    @ApiModelProperty(value = "使用单位")
    private String useUnit;
    @ApiModelProperty(value = "折扣")
    private String discount;
    @ApiModelProperty(value = "折扣金额")
    private BigDecimal discountPrice;
    @ApiModelProperty(value = "用药频次")
    private String frequency;
    @ApiModelProperty(value = "状态：0未支付，1：已支付")
    private Integer status;
    @ApiModelProperty(value = "已退个数")
    private Integer refundCount;
    @ApiModelProperty(value = "是否作废，0：否，1：是")
    private Integer isCancel;
    @ApiModelProperty(value = "药品用法")
    private String useFlag;
    @ApiModelProperty(value = "未处理数量")
    private Integer operateNum;

    /** 创建时间 */
    @TableField(fill= FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "药房id",required = true)
    @NotNull(message = "药房id不能为空")
    private String pharmacyId;

    @ApiModelProperty(value = "药品类型")
    @TableField(exist = false)
    private Integer drugType;

    @ApiModelProperty(value = "生产厂家")
    @TableField(exist = false)
    private String drugManufactor;
    @ApiModelProperty(value = "是否删除：0：否，1：是")
    private Integer deleteFlag;
    @ApiModelProperty(value = "是否退库存 0：否，1：是")
    private Integer refundType;
    @ApiModelProperty(value = "是否流转 0：否，1：是")
    private Integer isCirulation;
    @ApiModelProperty(value = "流转订单号")
    private String cirOrderNo;
    @ApiModelProperty(value = "流转处方号")
    private String cirInfoNo;
    @ApiModelProperty(value = "流转药品id")
    private Long cirDrugId;


    public void copy(InfoDrug source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
